<template>
  <div class="g-wrap"  >
    <div class="u-cover-rank">
      <img v-lazy="HotPlaylist.coverImgUrl" alt="">
    </div>
    <div class="m-info">
      <div class="hd">
        <i class="hd-icon-song-list"></i>
        <h2>{{HotPlaylist.name}}</h2>
      </div>
      <div class="user" v-if="HotPlaylist.creator">
        <img class="user-img" v-lazy="HotPlaylist.creator.avatarUrl"
             alt="">
        <span class="name" v-if="HotPlaylist.creator">
          <router-link :to="{name:'UserDetailView',params:{id:HotPlaylist.creator.userId,type:0}}">{{HotPlaylist.creator.nickname}}</router-link>
      </span>
        <img class="user-icon"
             v-if="HotPlaylist.creator.avatarDetail"
             :src="HotPlaylist.creator.avatarDetail.identityIconUrl"
             alt="">
        <span class="day">{{formatDate(HotPlaylist.createTime)}} 创建</span>
      </div>
      <div class="btns">
        <a href="javascript:;" class="ply" @click.prevent="sentSongUrl(HotPlaylist.tracks)">
          <i class="ply">
            <em class="ply"></em>
            播放
          </i>
        </a>
        <a href="javascript:;" class="ply" @click.prevent="addList((HotPlaylist.tracks))"></a>
        <a href="javascript:;">
          <i class="ply">({{HotPlaylist.subscribedCount}})</i>
        </a>
        <a href="javascript:;">
          <i class="ply">({{ HotPlaylist.shareCount }})</i>
        </a>
        <a href="javascript:;">
          <i class="ply">下载</i>
        </a>
        <a href="javascript:;">
          <i class="ply">({{HotPlaylist.commentCount}})</i>
        </a>
      </div>
      <div class="taps">
        <span>标签:</span>
        <router-link :to="{name:'PlayList',params: {name:item}}" v-for="(item,index) in HotPlaylist.tags" :key="index">{{item}}</router-link>
      </div>
      <p class="album-desc-dot"  v-if="isShow">
        <b>介绍：</b>
        <span v-html="HotPlaylist.descDot"></span>
      </p>
        <p class="desc-more" v-else>
          <b>介绍：</b>
          <span v-html="HotPlaylist.descMore"></span>
        </p>
      <div class="f-cb">
        <a href="javascript:;" class="zhankai" v-if="isShow" @click="changeShow('up')">展开</a>
        <a href="javascript:;" class="zhankai" v-else @click="changeShow('down')">收起</a>
        <i :class="u_icn"></i>
      </div>
    </div>
  </div>
</template>

<script>
import {formatDate} from '@/utils/formatDate'
export default {
  name: "index",
  data(){
    return {
      formatDate:formatDate,
      isShow:true,
      u_icn:'u-icn-down'
    }
  },
  methods:{
    addList(i){
      this.$store.commit('track/addMusic',i)
    },
    sentSongUrl(i){
      this.$store.commit('track/SETMUSIC',i[0])
      this.$store.commit('track/addMusic',i)
    },
    changeShow(str){
      this.isShow = !this.isShow
      if (str==='up'){
        this.u_icn = 'u-icn-up'
      }else {
        this.u_icn = 'u-icn-down'
      }
    }
  },
  props:['HotPlaylist'],
  mounted() {

  }
}
</script>

<style scoped lang="less">
.g-wrap {
  width: 640px;
  margin: 0 auto;
  padding-top: 40px;


  .u-cover-rank {
    width: 200px;
    height: 200px;
    float: left;
    position: relative;

    img {
      width: 208px;
      height: 208px;
    }

    span {
      position: absolute;
      top: 3px;
      left: 3px;
      width: 208px;
      height: 208px;
      background: url("../../assets/coverall.png") no-repeat -230px -380px;
    }
  }

  .m-info {
    width: 410px;
    margin-top: 20px;
    margin-left: 240px;

    .hd {

      margin-bottom: 10px;
      display: flex;
      justify-items: center;
      //align-items: center;

      .hd-icon-song-list {
        display: inline-block;
        margin-right: 10px;
        width: 54px;
        height: 24px;
        overflow: hidden;
        vertical-align: middle;
        background: url("../../assets/icon.png") no-repeat 0 -243px;
      }

      h2 {
        font-size: 20px;
        font-weight: 400;
        margin-top: -5px;
      }
    }

    .user {
      width: 410px;
      height: 35px;
      display: flex;
      margin-top: 10px;
      align-items: center;

      .name {
        a {
          color: #0c73c2;
        }
      }

      span {
        margin-left: 10px;
      }

      .day {
        margin-left: 20px;
        color: #999;
      }

      .user-img {
        width: 35px;
        height: 35px;
        vertical-align: center;
      }

      .user-icon {
        width: 13px;
        height: 13px;
      }
    }

    .btns {
      width: 483px;
      height: 31px;
      margin-top: 20px;

      .ply {
        background-repeat: no-repeat;
        background-image: url("../../assets/button2.png");
      }

      a {
        display: inline-block;
        float: left;

        i {
          margin-right: 5px;
          font-family: simsun, \5b8b\4f53;
          color: #666;
        }

        &:nth-child(1) {

          background-position: right -428px;

          i {
            padding: 0 10px 0 8px;
            display: inline-block;
            *display: inline;
            *zoom: 1;
            height: 31px;
            line-height: 31px;
            overflow: hidden;
            *line-height: 32px;
            vertical-align: top;
            text-align: center;
            cursor: pointer;
            color: #fff;
            background-position: 0 -387px;

            em {
              float: left;
              width: 20px;
              height: 18px;
              margin: 6px 2px 2px 0;
              background-position: 0 -1622px;
            }
          }
        }

        &:nth-child(2) {
          margin-right: 5px;
          width: 31px;
          height: 31px;
          margin-left: -3px;
          padding-right: 0;
          background-position: 0 -1588px;
        }

        &:nth-child(3) {
          i {
            background-position: 0 -977px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 7px 0 28px;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
            border-right: 1px solid #C3C3C3;
          }
        }

        &:nth-child(4) {
          i {
            background-position: 0 -1225px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 7px 0 28px;
            border-right: 1px solid #C3C3C3;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
          }
        }

        &:nth-child(5) {
          i {
            background-position: 0 -2761px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 10px 0 28px;
            border-right: 1px solid #C3C3C3;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
          }
        }

        &:nth-child(6) {
          i {
            background-position: 0 -1465px;
            float: left;
            height: 31px;
            line-height: 30px;
            min-width: 23px;
            cursor: pointer;
            padding: 0 10px 0 28px;
            border-right: 1px solid #C3C3C3;
            border-top-right-radius: 5px;
            border-bottom-right-radius: 5px;
          }
        }
      }
    }

    .taps {
      margin-top: 30px;
      width: 410px;
      height: 25px;
      line-height: 25px;
      display: flex;
      align-items: center;

      span {
      }

      a {
        border: 1px solid #D1D1D1;
        margin: 0 5px;
        display: inline-block;
        //width: 50px;
        height: 22px;
        padding: 0 12px 0 12px;
        color: #666;
        text-align: center;
        background-color: #F5F5F5;
        line-height: 22px;
        border-radius: 11px;
      }
    }
.desc-more{
  margin-top: 10px;
  line-height: 18px;
  b{
    font-weight: normal;
    color: #666;
  }
}
    .album-desc-dot {
      display: inline-block;
      margin-top: 10px;
      line-height: 18px;
      font-size: 12px;
      color: #666;
      width: 410px;
      //height: 180px;
      b{
        font-weight: normal;
        color: #666;
      }
    }
    .f-cb{
      width: 400px;
      text-align: right;
      .zhankai{
        color: #0c73c2;
      }
      .u-icn-down{
        display: inline-block;
        width: 11px;
        height: 8px;
        background: url("../../assets/icon.png") no-repeat -65px -520px;
      }
      .u-icn-up{
        display: inline-block;
        width: 11px;
        height: 8px;
        background: url("../../assets/icon.png") no-repeat -45px -520px;
      }
    }
  }
}
</style>